package com.jspgou.cms.manager.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jspgou.common.hibernate3.Updater;
import com.jspgou.common.page.Pagination;
import com.jspgou.cms.dao.MessageDao;
import com.jspgou.cms.entity.Message;
import com.jspgou.cms.manager.MessageMng;

@Service
@Transactional
public class MessageMngImpl implements MessageMng {
	
	public Pagination getPage(Long sendMemberId, Long receiverMemberId,
			String title, Date sendBeginTime, Date sendEndTime, Boolean status,
			Integer box, Boolean cacheable, int pageNo, int pageSize) {
		return dao.getPage(sendMemberId, receiverMemberId, title, sendBeginTime,
				sendEndTime, status, box, cacheable, pageNo, pageSize);
	}

	public Message findById(Integer id) {
		return dao.findById(id);
	}

	public Message save(Message bean) {
		return dao.save(bean);
	}

	public Message update(Message bean) {
		Updater<Message> updater = new Updater<Message>(bean);
		bean = dao.updateByUpdater(updater);
		return bean;
	}

	public Message deleteById(Integer id) {
		return dao.deleteById(id);
	}
	
	public Message[] deleteByIds(Integer[] ids) {
		return dao.deleteByIds(ids);
	}
	
	@Autowired
	private MessageDao dao;

}